<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" >
        <link rel="stylesheet" href="../vender/css/normalize.css">
        <title>支付</title>
        <link rel="stylesheet" href="coach-me.css">
        <link rel="stylesheet" href="../public/public_footer.css">
    </head>
    <body>
        <header>
            <div class="left-header" >
                <input type="file" name="file" onchange="UpladFile()" class="file" id="file" size="28"  style="display: none"/>
                <img src="">
            </div>
            <div class="right-status">
                <div class="username">
                    <h3>加载中</h3>
                    <input  id="signature" value=""  type="value">
                </div>

            </div>
        </header>
        <section>
            <ul style="background: #F5F5F5">
                <li onclick="window.location.href='../own_set/lianxi.html'">
                    <span >个人资料</span>
                    <button></button>
                </li>
                <li onclick="window.location.href='../student_admin/student.html'">
                    <span>学员管理</span>
                    <button></button>
                </li>

                <!--<li>-->
                <!--<span>我的卡券</span>-->
                <!--<button></button>-->
                <!--</li>-->
                <!--<li>-->
                <!--<span>i驾之路</span>-->
                <!--<button></button>-->
                <!--</li>-->
                <!--<li onclick="window.location.href='../distence/distence.html'">-->
                <!--<span>教学范围</span>-->
                <!--<button></button>-->
                <!--</li>-->
                <!--<li onclick="window.location.href='../autograph/sign.html'">-->
                <!--<span>个人简介</span>-->
                <!--<button></button>-->
                <!--</li>-->
                <li onclick="window.location.href='../pricing/prise.html '">
                    <span>教学定价</span>
                    <button></button>
                </li>
                <li onclick="window.location.href='../pricing/pay.html '">
                    <span>绑定支付宝</span>
                    <button></button>
                </li>
                <li onclick='tel://028-67877758'>
                    <span>客服中心</span>
                    <button></button>
                </li>
                <li onclick="window.location.href='../setting/setting.html'"  style="margin-top: 0.1rem;">
                    <span>设置</span>
                    <button></button>
                </li>

            </ul>
        </section>
        <footer id="public_footer">
            <ul >
                <li class="order"  onclick="window.location.href='../order/oder.html'">
                    <img src="../img/footer_list.png" alt="">
                </li>
                <li onclick="window.location.href='../plan/plan_1.html'">
                    <img src="../img/footer_plan.png" alt="">
                </li>
                <li onclick="window.location.href='../cash/cash.html'">
                    <img src="../img/footer_cash.png" alt="">
                </li>
                <li  >
                    <img src="../img/footer_me_on.png" alt="">
                </li>
            </ul>
        </footer>
        <script src="../jquery.min.js	"></script>

        <script>



            $(function () {

                var token=localStorage.phone;
                $.ajax({
                    url:'https://newapp.icandrive.cn/api/coach_photo.php',
                    data:{token:token},
                    dataType:'json',
                    type:'post',
                    success: function (data) {
                        if(data.status==200){
                            $(data.data).each(function () {
                                $('.left-header img').attr('src',this.teacher_photo);
                                $('.username h3').html(this.teacher_name);
                                $('#signature').val(this.autograph);
                                localStorage.place1=(this.subject2_place);
                                localStorage.place2=(this.subject3_place);
                            });

                        }
                    }
                })
            });


            $('#signature').bind('change',function(){
                var content=$(this).val();
                var token=localStorage.phone;
                $.ajax({
                    url:'https://newapp.icandrive.cn/api/teacher_intro.php',
                    data:{token:token,content:content},
                    dataType:'json',
                    type:'post',
                    success: function (data) {
                        if(data.status==200){

                        }
                        else{
                            layer.msg('保存失败')
                        }
                    },
                    error:function(){
                        layer.msg('系统繁忙')
                    }
                })

            })



            var xhr;

            function createXMLHttpRequest() {
                if (window.ActiveXObject) {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                } else if (window.XMLHttpRequest) {
                    xhr = new XMLHttpRequest();
                }
            }

            function UpladFile() {
                var token=localStorage.phone;
                var fileObj = document.getElementById("file").files[0];
                var FileController = 'https://newapp.icandrive.cn/api/photo.php?token='+token;
                var form = new FormData();
                form.append("myfile", fileObj);
                createXMLHttpRequest();
                xhr.onreadystatechange = handleStateChange;
                xhr.open("post", FileController, true);
                xhr.send(form);
            }

            function handleStateChange() {
                if (xhr.readyState == 4) {
                    if (xhr.status == 200 || xhr.status == 0) {
                        var result = xhr.responseText;
                        var json = eval("(" + result + ")");
                        setTimeout(function(){
                            history.go(0)
                        },2000)

                    }
                }
            }
        </script>

        <script>
            document.addEventListener("plusready", function() {
                // 注册返回按键事件
                plus.key.addEventListener('backbutton', function() {
                    // 事件处理
                    plus.nativeUI.confirm("退出程序？", function(event) {
                        if (event.index) {
                            plus.runtime.quit();
                            localStorage.clear();
                        }
                    }, null, ["取消", "确定"]);
                }, false);
            });

        </script>
    </body>
</html>
